$(function () {


    getSavelist();
    var pageid = 0;

    function getSavelist() {
        $.ajax({
            type: "get",
            url: "http://193.112.55.79:9090/api/getmoneyctrl",
            data: {
                pageid: pageid
            },
            dataType: "json",
            success: function (result) {
                console.log(result);
                var page = Math.ceil(result.totalCount / result.pagesize)
                var option = '';
                for (var i = 0; i <= page; i++) {
                    option += '<option value=' + i + '>' + (i + 1) + '</option>';
                }
                $('#select').html(option);
                $('#select').val(pageid);
                var result = result['result'];
                var saveTemp = template('saveTemp', {
                    list: result
                });
                $('.cu-list>ul').html(saveTemp);
            }
        });
    }
    if ('addEventListener' in document) {
        document.addEventListener('DOMContentLoaded', function () {
            // document.body:说明document.body中所有元素都会使用fastclick来实现单击事件的触发
            FastClick.attach(document.body);
        }, false);
    }
    $('.prve').on('click',function(){
        pageid--;
        getSavelist();
    })
    $('.next').on('click',function(){
        pageid++;
        getSavelist();
    })
    
    $('#select').on('change',function(){
        console.log($('#select').val());
        pageid=$('#select').val();
        getSavelist();
    
    })

})